No. The compiler completely ignores them. Comments are just for human readers of the source program.
class Haiku { public static void main ( String[] args ) { System.out.println("On a withered branch" ); // Write first line of the poem System.out.println("A crow has just alighted:"); // Write 2nd line of the poem System.out.println("Nightfall in autumn."); // Write 3rd line of the poem } }
Comments can be placed after a program statement to explain what it does, as here.
The //
and everything after on that
line are ignored by the compiler.
The program statement in the start of the line is not affected by the comment.
Would you ever want to write an entire paragraph of comments?